<script setup>
import TheIcon from "./TheIcon.vue";
const emit = defineEmits(["close"]);

const closeModal = () => {
  // console.log("closeModal");
  emit("close");
};
</script>

<template>
  <Teleport to="body">
    <div class="modal">
      <div class="backdrop"></div>
      <div class="modalContent">
        <button class="closeBtn" @click="closeModal">
          <TheIcon icon="close"></TheIcon>
        </button>
        <slot></slot>
      </div>
    </div>
  </Teleport>
</template>

<style scoped>
.modal {
  position: fixed;
  width: 100vw;
  height: 100vh;
  left: 0;
  top: 0;
  max-width: 100%;
  /* background-color: pink; */
  display: grid;
  place-items: center;
}

.backdrop {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modalContent {
  position: relative;
  /* height: 400px; */
  /* width: 600px; */
  background-color: white;
  border-radius: 52px;
  overflow: hidden;
}

.closeBtn {
  position: absolute;
  background: none;
  border: none;
  right: 14px;
  top: 10px;
}

.closeBtn svg {
  width: 54px;
  height: 54px;
}
</style>
